package com.niuxiaofa.newlaw.View;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.niuxiaofa.newlaw.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class DownloadDialog extends Dialog {

    @BindView(R.id.progressBar)
    ProgressBar progressBar;


    int currentLengths = 0;


    @BindView(R.id.schedule_text)
    public TextView schedule_text;



    public void setcurrent(int currentLengths) {
        this.currentLengths = currentLengths;
        handler.sendEmptyMessage(1);
    }


    public DownloadDialog(@NonNull Context context) {
        super(context, R.style.AlertDialog);

    }


    protected void onCreate(Bundle bundle) {
        setContentView(R.layout.dialog_download);
        ButterKnife.bind(this);


    }


    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            Log.e("jndu", currentLengths + "");
            progressBar.setProgress(currentLengths);
            schedule_text.setText(currentLengths + "");
        }
    };


}
